package com.babster631;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class thunderpickaxe extends ItemPickaxe {
        public thunderpickaxe(int par1, EnumToolMaterial et) {
                super(par1, et);
                this.setCreativeTab(CreativeTabs.tabTools);
                }
    public void registerIcons(IconRegister iconReg) {
        itemIcon = iconReg.registerIcon("babster631modbase:thunderpickaxe.fw");
    }
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
    	if (!par2World.isRemote)
    	{
    		par3EntityPlayer.posY+=.5f;
    		MovingObjectPosition cor=par3EntityPlayer.rayTrace(100, 1);
    		if (cor!=null)
    		{
	    		if (par2World.getBlockId(cor.blockX, cor.blockY, cor.blockZ)==Block.cobblestone.blockID)
	    		{
	    			par2World.setBlock(cor.blockX, cor.blockY, cor.blockZ, Block.stone.blockID);
	    			par1ItemStack.damageItem(1, par3EntityPlayer);
	    		}
    		}
    		par3EntityPlayer.posY-=.5f;
    	}
		return par1ItemStack;	
    }
}